package com.ty.day3;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create 2023/11/8 15:13
 */
public class Three {
    public static void main(String[] args) {
        /**
         * 判断闰年
         */
        int year = 2023;
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            System.out.println(year + "是闰年");
        } else {
            System.out.println(year + "不是闰年");
        }

        //        1~100能被2、3、5同时整除的个数
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            if (i % 2 == 0 && i % 3 == 0 && i % 5 == 0) {
                count++;
            }
        }
        System.out.println("1~100能被2、3、5同时整除的个数:" + count);
//        1~100能被2或3整除
        count=0;
        for (int i = 1; i <= 100; i++) {
            if (i % 2 == 0 && i % 3 == 0 && i % 5 != 0) {
                count++;
            }
        }
        System.out.print("1~100能被2、3整除但不能被5整除的个数:" + count);
    }
}
